import mitt from 'mitt'
const Mit = mitt()
export interface ILine {
	aX:number,
	aY:number,
	bX:number,
	bY:number,
	color:string,
	$el:HTMLElement,
	number:number
}

export interface ILizhao {
    bus: typeof Mit,
    url: {
        get: (url: string, name: string)=>any
    }
	base64:{
		encode: (url: string)=>any
		decode: (url: string)=>any
	},
	treeToArray:(arr: Array<any>,treeProps:IObject<any>)=>any,
    arrayToTree: (arr: Array<any>, treeProps: IObject<any>)=>any,
	throttle:(func: () => any,wait?:number,immediate?:boolean)=>any,
	debounce:(func: () => any,wait?:number,immediate?:boolean)=>any,
	timeFormat:(timestamp: Number|String,format?:String)=>any,
	timeFrom:(timestamp: Number|String,format?:String|Boolean)=>any,
	guid:(length: Number|null,firstU?:Boolean,radix?:Number)=>any,
	deepClone:(object : IObject<any>)=>any,
	deepMerge:(target : IObject<any>,source : IObject<any>)=>any,
	params:(param : IObject<any>)=>any,
	showNotificationparams:(string : String)=>any,
	ui:{
		drawElectronicSeal: (params:IObject<any>)=>any,
		onlineWps: (params:IObject<any>)=>any,
		addressBook: (params:IObject<any>)=>any,
		applicationForm: (params:IObject<any>)=>any,
		previewForm: (params:IObject<any>)=>any,
		seeVideo: (params:IObject<any>)=>any,
	},
	file:{
		base64: (params:IObject<any>)=>any,
		size: (name:Number)=>any,
		icon: (name:String)=>any,
		type: (name:String)=>any
	},
	createLine:(obj:ILine)=>any,
	clearLine:(id:string)=>any,
	table:{
		renderHeader: (params:any)=>any,
	},
	test:{
		email: (params: any)=>Boolean,
		mobile: (params:any)=>Boolean,
		url: (params:any)=>Boolean,
		date: (params:any)=>Boolean,
		dateISO: (params:any)=>Boolean,
		number: (params:any)=>Boolean,
		string: (params:any)=>any,
		digits: (params:any)=>any,
		idCard: (params:any)=>any,
		carNo: (params:any)=>any,
		amount: (params:any)=>any,
		chinese: (params:any)=>any,
		letter: (params:any)=>any,
		enOrNum: (params:any)=>any,
		contains: (params:any)=>any,
		range: (params:any)=>any,
		rangeLength: (params:any)=>any,
		landline: (params:any)=>any,
		empty: (params:any)=>any,
		jsonString: (params:any)=>any,
		array: (params:any)=>any,
		object: (params:any)=>any,
		code: (params:any)=>any,
		func: (params:any)=>any,
		promise: (params:any)=>any,
		image: (params:any)=>any,
		video: (params:any)=>any,
		regExp: (params:any)=>any,
		checkEmail: (params:any)=>any,
		checkMobile: (params:any)=>any,
		checkLandline: (params:any)=>any,
		checkLandlineAndMobile: (params:any)=>any,
		
	}
}



export interface IWorkflowData {
    'tableId': [string | number],// 审批id
    'workFlowDef': IWorkFlowDef,// 审批单信息
    'directorMaxLevel': number,// 审批主管最大层级
    'flowPermission': Array<string>,// 发起人
    'nodeConfig': INodeConfig
}

export interface INodeConfig {
    'nodeName': string,// 节点名称 发起人
    'type': number,// 0 发起人 1审批 2抄送 3条件 4路由
    'priorityLevel': string,// 条件优先级
    'settype': number,// 审批人设置 1指定成员 2主管 4发起人自选 5发起人自己 7连续多级主管
    'selectMode': number, // 审批人数 1选一个人 2选多个人
    'selectRange': number, // 选择范围 1.全公司 2指定成员 2指定角色
    'directorLevel': number, // 审批终点  最高层主管数
    'examineMode': number, // 多人审批时采用的审批方式 1依次审批 2会签
    'noHanderAction': number,// 审批人为空时 1自动审批通过/不允许发起 2转交给审核管理员
    'examineEndDirectorLevel': number, // 审批终点 第n层主管
    'ccSelfSelectFlag': number, // 允许发起人自选抄送人
    'conditionList': [], // 当审批单同时满足以下条件时进入此流程
    'nodeUserList': Array<string>, // 操作人
    'childNode'?: INodeConfig,
    'conditionNodes'?:[]
}

export interface IWorkFlowDef {
    'name': string,// 审批名称
}